//package cn.bonoon.controllers.parsers;
//
//import javax.servlet.http.HttpServletRequest;
//
//import cn.bonoon.kernel.events.PanelEvent;
//import cn.bonoon.kernel.menus.IMenuInfo;
//import cn.bonoon.kernel.menus.IModuleInfo;
//import cn.bonoon.kernel.menus.MenuInfo;
//import cn.bonoon.kernel.menus.ModuleManager;
//import cn.bonoon.kernel.security.LogonUser;
//import cn.bonoon.kernel.security.PrivilegeChecker;
//import cn.bonoon.kernel.web.KeyChecker;
//import cn.bonoon.kernel.web.controllers.PanelParser;
//import cn.bonoon.kernel.web.models.LayoutModel;
//
//public class SuperPanelParser implements PanelParser {
//
//	private final ModuleManager moduleManager;
//	
//	public SuperPanelParser(ModuleManager moduleManager){
//		this.moduleManager = moduleManager;
//	}
//	
//	@Override
//	public PanelEvent parse(String mid, HttpServletRequest request, LogonUser user) throws Exception {
//		if(!user.isSuper()) throw new Exception("不允许访问该功能！");
//		String home = moduleManager.getEndpoint();
//		LayoutModel layout = new LayoutModel(mid, request, home);
//		IModuleInfo module = moduleManager.module();
//		MenuInfo mi = 
//		layout.buildChannel(, user, null, null);
//		
//		StringBuilder hostChannel = layout.getChannelItems();
//		hostChannel.append("<ul><li><a href='").append(home).append("'><span>首页</span></a></li><li><a href='").append(moduleManager.settingUrl()).append("/s/user/settings'><span>个人中心</span></a></li><li class='lastChannelSelected'><a href='#'><span>系统管理</span></a></li></ul>");
//		StringBuilder menus = layout.menuBuilder();
//		IMenuInfo selected = null;
//		for(IMenuInfo item : moduleManager.getSuperMenus()){
//			menus.append("<li><span>");
//			if(item.selected(mid)){
//				item.button(menus, "menuSelected");
//				selected = item;
//			}else{
//				item.button(menus, "");
//			}
//			menus.append("</span></li>");
//		}
//		String title;
//		if(null == selected){
//			title = "系统管理";
//		}else{
//			title = "系统管理->" + selected.getName();
//		}
//		layout.addObject(KeyChecker.CHECKER_PROPERTY_NAME, KeyChecker.EMPTY);
//		layout.initLayout(title, moduleManager);
//		return new PanelEvent(layout, user, PrivilegeChecker.ALL);
//	}
//}
